public class array2 {
    public static void main(String[] args) {
        System.out.println("Hello Array");
        int[] nums = {0, 1, 0, 3, 12 };
        moveZeroes(nums);

        for (int i = 0; i < nums.length; i++) {
            System.out.println("nums["+i+"]="+nums[i]);
        }

    }
    static void moveZeroes(int[] nums) {
        int n = 0;
        for (int i=n; i< nums.length; i++) {
            if (nums[i] != 0) {
                nums[n] = nums[i];
                n++;    
            }

        }
        while (n < nums.length) {
            nums[n] = 0;
            n++;
        }


        
    }
}
